<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>

    <div id="app">
        <button v-on:click="reduce(100)">减少100分</button>
        <button v-on:click="add(100)">增加100分</button>
        <p>期末考试总成绩是: {{ num }}分</p>
    </div>
<!--引入vue文件-->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
    const vm = Vue.createApp({
        data() {
            return {
                num: 3600
            }
        },
        methods: {
            add: function(change) {
                this.num += change
            },
            reduce: function(change) {
                this.num -= change
            },
        }
    }).mount('#app');
</script>

</body>
</html>
